import React from 'react'
import {createStore} from 'redux'

function reducer(state = 0, action){
        switch(action.type){
            case 'add':
                return state + 1
            default:
                return state
        }
}

let store = createStore(reducer)

export default function(){
    return (
        <div>
            <button onClick={()=> store.dispatch({type:'add',num:1})}>{store.getState()}</button>
        </div>        
    )
}